package com.sky.mapper;

import com.sky.entity.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface AdminOrderMapper {

    //统计各个状态的订单
    @Select("select count(id) from orders where status=#{status}")
    Integer countStatis(Integer status);

    //根据订单id获取订单详细信息
    @Select("select *from orders where id=#{id}")
    Orders details(Long id);

    //取消订单
    @Update("update orders set status=6,cancel_reason=#{cancelReason},cancel_time=#{cancelTime} where id=#{id}")
    void cancel(Orders orders);


    @Update("update orders set status=#{status},delivery_time=#{deliveryTime} where id=#{id}")
    void complete(Orders orders);

    @Update("update orders set status=#{status},cancel_time=#{cancelTime},rejection_reason=#{rejectionReason} where id=#{id}")
    void reject(Orders orders);

    @Update("update orders set status=#{status} where id=#{id}")
    void confirm(Orders orders);

    @Update("update orders set status=#{status} where id=#{id}")
    void delivery(Orders orders);
}
